//
//  PersonTopTableViewCell.m
//  XRSquare
//
//  Created by 穆相臣 on 2018/8/24.
//  Copyright © 2018年 UaenaMo. All rights reserved.
//

#import "PersonTopTableViewCell.h"

@interface PersonTopTableViewCell ()
{
    UIImageView * imageView;
    UILabel * nameLabel;
    UILabel * descriptionLabel;
}
@end

@implementation PersonTopTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        self.backgroundColor = themeColor;
        
        imageView = [[UIImageView alloc]initWithFrame:CGRectMake(20, 60, 60, 60)];
        imageView.layer.cornerRadius = 30;
        imageView.contentMode = UIViewContentModeScaleAspectFill;
        imageView.clipsToBounds = YES;
        [self addSubview:imageView];
        
        nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(100, 60, ScreenWidth, 60)];
        nameLabel.textColor = [UIColor whiteColor];
        [self addSubview:nameLabel];
     
    }
    return self;
}

+(CGFloat)height
{
    return 150;
}

-(void)loadimage:(NSString *)image name:(NSString *)name age:(NSString *)age description:(NSString *)description
{

        [imageView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://pic.xrsquare.com/%@",image]]];
        NSMutableAttributedString * att = [[NSMutableAttributedString alloc]initWithString:name attributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:17]}];
        [att appendAttributedString:[[NSAttributedString alloc]initWithString:[NSString stringWithFormat:@" %@岁",age] attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:15]}]];
        nameLabel.attributedText = att;
        descriptionLabel.text = description;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
